chrome.runtime.onConnect.addListener(port => {
    console.assert(port.name === "resourceChannel");
    port.onMessage.addListener((msg) => {
      if (msg.action === "fetchData" && msg.resourceId) {
        const url = `https://v2.jinrishici.com/info?test=${msg.resourceId}`;
        fetch(url)
          .then(response => response.json())
          .then(data => {
            console.log('-0----------------------')
            console.log(data)
            
            port.postMessage({ data: data });
          })
          .catch(error => {
            console.error("Error fetching data:", error);
            port.postMessage({ error: error });
          });
      }
    });
  });
  